function validate(f){
      if(!(/^\d{3,16}$/.test(f.id.value))){   	 
      alert("用户ID必须为3到16位的数字");
      f.id.focus();
      //alert("fewfewf1233");
      return false;
        }
      if(!(/^\w{3,16}$/.test(f.password.value))){
      alert("用户密码必须为3到16位");
      f.password.focus();
      return false;
        }
      if(!(/^\w{3,16}$/.test(f.name.value))){
      alert("用户昵称必须为3到10位");
      f.password.focus();
      return false;
        } 
      
      return true;
      }
function createXMLHttp(){
	var XMLHttpReq;
    try {
        XmlHttp = new XMLHttpRequest();
       //alert("nihao");
    }
    catch ( e) {
        var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP");
        for (var i = 0; i < XmlHttpVersions.length && !xmlHttp; i++) {
            try {
                XMLHttpReq = new ActiveXObject(XmlHttpVersions[i]);
            }
            catch (e) {
            }
        }
    }
}
function checkUserid(id){
	if(!(/^\d{3,16}$/.test(id))){
		alert("用户ID必须为3到16位的数字");
		//response.write(id="");
	}
	else{
	createXMLHttp();
	XmlHttp.open("POST","checkServlet?userid="+id,true);
	//alert(id);
	XmlHttp.onreadystatechange=checkUseridCallback;
	//alert("nihao2");
	XmlHttp.send(null);
	}
	//document.getElementById("msg").innerHTML="正在验证...";
}
function checkUseridCallback(){
	var flag ;
	if(XmlHttp.readyState==4){
		if(XmlHttp.status==200){
		  var text=XmlHttp.responseText;
		  //alert("fewfw");
	        if(text=="true"){
	        	flag=false;
	        	document.getElementById("msg").innerHTML="*账号已存在";	        	
	        }
	        else{
	        document.getElementById("msg").innerHTML="此账号可以使用";
	        }
		}
	}
	
	
}
function checkForm(){
	return flag;
	
}
function ShanChuMoRen(){
	if(document.getElementById("textfield").firstChild.nodeValue="限150字")
		{document.getElementById("textfield").firstChild.nodeValue="";}
}
function defaultinfo(){
   if(document.getElementById("textfield").firstChild.nodeValue!=""){
		
   }
   else{
	   document.getElementById("textfield").firstChild.nodeValue="限150字";
   }
}
/*function daojishi(){
	//alert("fewfewf");
	jisuan();
	setTimeout("jisuan()",1000);
	setTimeout("jisuan()",2000);
	
}
function jisuan(){
	alert("123fewfewf");
	var str=document.getElementById("shuzi").Value;
	alert(str);
	var time_daojishi=str.innerHTML;
	time_daojishi=int_val-1;	
	
}

*/